<?php

namespace App\Http\Controllers\Api;

use App\Models\FangAttr;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class FangAttrController extends Controller
{
    //房源属性列表
    public function index()
    {
        //租金范围  fang_rent_range
        //租赁方式  fang_rent_class
        //房源区域  fang_area
        //取出所有房源属性
        $data=Fangattr::get()->toArray();
        $data=subTreeName($data);
        //返回用于快搜的属性
        return [
            'status'=>0,
            'msg'=>'成功',
            'data'=>[
                'fang_rent_range'=>$data['fang_rent_range']['sub'],
                'fang_rent_class'=>$data['fang_rent_class']['sub'],
                'fang_area'=>$data['fang_area']['sub']
            ]
        ];
    }
}
